<!DOCTYPE html>
<html class="login-alone">
    <head>
        <title>2016毕业设计(群聊系统)</title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <link rel="shortcut icon" type="image/x-icon" href="static/homepage/favicon.ico?v=3.9" />
        <link href="static/ui/css/screen.css?v=3.9" media="screen, projection" rel="stylesheet" type="text/css" >
        <link rel="stylesheet" type="text/css" href="static/ui/css/base.css?v=3.9">
        <link rel="stylesheet" type="text/css" href="static/passport/css/login.css?v=3.9">
    </head>
    <body ng-app="myApp" ng-controller="btnCtrl">
        <div class="logina-logo" style="height: 55px">
            <a href="">
                <img src="static/passport/images/login.jpg?v=3.9" height="60" width="400" alt="">
            </a>
        </div>
        <div class="logina-main main clearfix">
            <div class="tab-con">
                <form id="form-login" method="post" action="#" >
                    <div id='login-error' class="error-tip"></div>
                    <table border="0" cellspacing="0" cellpadding="0">
                        <tbody>
                            <tr>
                                <th>账户</th>
                                <td width="245">
                                    <input id="email" type="text" name="username" ng-model="formData.username" placeholder="请输入账号" autocomplete="off" value=""></td>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <th>密码</th>
                                <td width="245">
                                    <input id="password" type="password" name="password" ng-model="formData.password" placeholder="账号" autocomplete="off">
                                </td>
                                <td>
                                </td>
                            </tr>
                            
                            <tr class="find">
                                <th></th>
                                <td>
                                    <div>
                                        <label class="checkbox" for="chk11"><input style="height: auto;" id="chk11" type="checkbox" name="remember_me" >记住我</label>
                                        <a href="passport/forget-pwd">忘记密码？</a>
                                    </div>
                                </td>
                                <td></td>
                            </tr>
                            <tr>
                                <th></th>
                                <td width="245"><input class="confirm" type="button" ng-click="asave()" value="登  录"></td>
                                <td></td>
                            </tr>
                        </tbody>
                    </table>
                    <input type="hidden" name="refer" value="site/">
                </form>
            </div>
            <div class="reg">
                <p>还没有账号？<br>赶快免费注册一个吧！</p>
                <a class="reg-btn" href="/register">立即免费注册</a>
            </div>
        </div>
        <div id="footer">
            <div class="copyright">Copyright © 2016 骆名高的群聊系统</div>
        </div>
     
        
    </body>
	    <script src="/static/js/jquery-2.1.1.min.js"></script>
		<script src="/static/js/aj.js"></script>
		<script src="/static/layer-2.4/layer.js"></script>  
<script type="text/javascript">
var app = angular.module('myApp',[]);
    app.config(['$interpolateProvider', function($interpolateProvider) {
  $interpolateProvider.startSymbol('[[');
  $interpolateProvider.endSymbol(']]');
}]);
var btnCtrl = app.controller('btnCtrl',['$scope','$http',function($scope,$http){
     $scope.asave= function(){
          //var data = 'username=admin&password=13456'
         $http({
             method: 'POST',
             url: '/login',
             data: $.param($scope.formData), // pass in data as strings
             headers: {'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8'}  
         }).success(function (data) {
           if(data.errorNumber==0x01){
            layer.alert('用户名不存在', {icon: 5});
            //layer.alert("用户名不存在");
          }else if(data.errorNumber==0x02){
             layer.alert('密码不正确', {icon: 2});
          }else if(data.errorNumber==0x17){
             // layer.alert('用户已登录', {icon: 5});
             layer.msg('用户已登录', {
               offset: 0,
               shift: 6
});
           }else{  
         ////加载层-风格4
       layer.msg('登录中', {icon: 16});
        url="/chat?username=" + data.info;
        setTimeout(function(){
       layer.closeAll('loading');
            }, 3000);
            //layer.alert('登录成功', {icon: 6});
             location.href = url;
           }
          });
 
     };
 }]);
</script>
</html>
